<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
    <title>欢迎登陆</title>
    <script src="http://libs.baidu.com/jquery/2.1.4/jquery.min.js"></script>
    <script type="text/javascript">

        function clickBtn() {
            let email = $("#email").val();
            let password = $("#password").val();

            if (password == ''){
                $("#error-msg").text("密码不能为空");
                return;
            }

            let uri = '/api/user/login/' + email + '/' + password;

            $.post(uri, function (data) {
                console.log("登录请求结果: " + data);
                if (data == "successfully") {
                    window.location.href = "./welcome.html";
                } else {
                    $("#error-msg").text("新用户，请先注册");
                }
            })
        }
    </script>
</head>
<body>
1269285420@qq.com
<div style="margin: auto;  width: 80%;">
    <div style="margin-top: 50px; margin-left: 100px;">
        <p>
            <span id="error-msg" style="color: red; margin-left: 50px;"></span>
        </p>
        <label for="email">邮 箱</label> <input id="email" name="email" type="text" /> <br>
        <label for="password">密 码</label> <input id="password" name="password" type="password"/> <br>

        <button onclick="clickBtn()" style="margin-top:10px; width: 180px; height: 30px; background-color: blue; color: antiquewhite;">登陆</button> <br>
        <a href="./register.html" style="margin-left: 45px; margin-top: 5px;">注册新账号</a>
    </div>
</div>

</body>
</html>